<?php
$id = $_GET['id']; //id portfolio
// instacia Objeto "conexao".
$mysql = new conexao;
// Executa uma query 
if(intval($id)>0){
        $where = 'WHERE c.id_categoria='.$id;
}
$portfoliolista = $mysql->sql_query(
        "
select p.*, c.nome_categoria,img.nome, img.extensao 
				from portfolio p
				LEFT JOIN portfolio_para_categorias pc
					ON pc.portfolio_id_portfolio=p.id_portfolio
				LEFT JOIn categorias c
					ON c.id_categoria=pc.categorias_id_categoria
				LEFT JOIN imagens img 
					ON img.portfolio_id_portfolio = p.id_portfolio 
				".$where." group by p.id_portfolio 
				
");

// Desconecta do Banco de Dados
$mysql->desconecta;
/**
 * 
 */
?>


<div class="content ">
    <link  rel="stylesheet" type="text/css" href="css/colorbox.css"/>
    <script src="./js/jquery.colorbox-min.js"></script>
    <script src="./js/functions.js"></script>
    <script>
        $(document).ready(function(){
            //Examples of how to assign the ColorBox event to elements
            $(".teste").colorbox({iframe:true, width:"980px", height:'650px', opacity: 0.5, scrolling: false});
            //$(".teste").colorbox({rel:'teste', transition:"none", width:"auto", height:"auto"});
				
        });
    </script>

    <div class="internaPortfolio">
        <h1 style="width:904px;">Portfolio</h1>
        <div class="categorias">
            <ul>
                <li><a href="?p=portfolio">Todos</a></li>
                <li><a href="?p=portfolio&id=1">Residencial</a></li>
                <li><a href="?p=portfolio&id=2">Restaurantes e Fast Foods</a></li>
                <li><a href="?p=portfolio&id=3">Corporativos</a></li>
                <li><a href="?p=portfolio&id=4">Lojas</a></li>
                <li><a href="?p=portfolio&id=5">Hospitalares</a></li>
                <li class="clear"></li>
            </ul>
        </div>
        <div class="box-geral">
            <?php
            while ($portfolios = mysql_fetch_object($portfoliolista)) {
                ?>
                <div class="box">
                    <img src="../cms/uploads/portfolio/<?php
            echo $portfolios->nome;
            echo $portfolios->extensao
                ?>" alt="" />
                    <div class="box-show">
                        <div class="box-content">
                            <div class="cat"><?php echo $portfolios->nome_categoria ?></div>
                            <div class="nome"><a href="./galeria.php?id=<?php echo $portfolios->id_portfolio ?>" class="teste"><?php echo $portfolios->nome_projeto ?></a></div>
                            <div class="localidade"><?php echo $portfolios->localidade ?></div>

                            <div class="likethis">
                            <iframe src="http://www.facebook.com/plugins/like.php?href=http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ?>%26idPort=<?php echo $portfolios->id_portfolio ?>&layout=button_count&<br> 
show_faces=false&width=380&action=like&colorscheme=light&height=25&locale=pt_BR" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:25px;" allowTransparency="true"></iframe>
                            </div>
                        </div>
                    </div>
                </div>

            <?php } ?>	
            <div class="clear"></div>
        </div>
    </div>
